﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace RightControl.Common {
    public class Encrypt {

        public static byte[] HmacSHA256Hash(string key, string str) {
            return HmacSHA256Hash(Encoding.UTF8, key, str);
        }

        private static byte[] HmacSHA256Hash(Encoding encode, string key, string str) {
            HMACSHA256 hMACSHA = new HMACSHA256(encode.GetBytes(key));
            return hMACSHA.ComputeHash(encode.GetBytes(str));
        }

    }
}
